package org.example.ssmDemo.service;

import java.util.List;
import javax.annotation.Resource;
import org.example.ssmDemo.mapper.HospitalMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

/**
 * @author cliang.liangchao
 * @version 1.0
 * @Description:
 * @date: 2021/11/16
 */
@Service
public class HospitalService {

    @Resource
    private HospitalMapper hospitalMapper;

    private static Logger LOGGER = LoggerFactory.getLogger(HospitalService.class);

    public void formatHospData() {
        long total = hospitalMapper.getHospCount();
        LOGGER.info("开始整理医院和科室关系数据...");
        /**
         * 每次获取的医院个数
         */
        int processPerCount = 100;
        for (int pageNo = 0; pageNo * processPerCount < total; pageNo++) {
            List<String> hospNameList = hospitalMapper.getHospNameList(pageNo * processPerCount,
                    processPerCount);
            LOGGER.info("The task is dealing with data no.{} to no.{}", (pageNo * processPerCount) + 1,
                    (pageNo + 1) * processPerCount);

        }
    }

}
